package com.example.community.list;

import com.example.community.dao.ParkingDao;
import com.example.community.dao.RoomDao;
import com.example.community.model.Parking;
import com.example.community.model.Room;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(urlPatterns = "/hsfj")
public class HsfjServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String usNo = req.getParameter("usNo");
        RoomDao roomDao = new RoomDao();
        Room room = roomDao.fandByUsNo(Integer.parseInt(usNo));
        room.setUsNo(null);
        Integer update = roomDao.update(room);
        if (update == 1){
            resp.getWriter().write("true");
        }else {
            resp.getWriter().write("false");
        }

    }
}
